define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'user.income/index',
        add_url: 'user.income/add',
        edit_url: 'user.income/edit',
        delete_url: 'user.income/delete',
        export_url: 'user.income/export',
        modify_url: 'user.income/modify',
        viewinfo_url: 'user.income/viewinfo',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'ID'},
                    {field: 'nickname', title: '用户昵称'},
                    {field: 'income_total', title: '总收益'},
                    {field: 'income', title: '可提现收益'},
                    {field: 'withdrawal', title: '已提现'},
                    {field: 'income_order_count', title: '收益订单数量'},
                    {width: 250, title: '操作', 
                    // templet: ea.table.tool
                    templet: function (row) {
                        return ea.table.tool(row, {
                            init, // 初始化的数据变量
                            operat: [
                                [{
                                    text: '查看订单详细',
                                    url: init.viewinfo_url,
                                    method: 'open',
                                    auth: 'viewinfo',
                                    class: 'layui-btn layui-btn-xs layui-btn-success',
                                    extend: 'data-full="true"',
                                },],
                            ]
                        })
                     },
                },
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});